package com.accenture.adf.newcodington.module16.sample;

import org.junit.Test;

import junit.framework.TestCase;

/**
 * Testcase for demonstrate unit tests for MyCalculatorSeeIt
 */
public class TestMyCalculatorSeeIt extends TestCase {

	MyCalculatorSeeIt calculator;

	protected void setUp() throws Exception {
		super.setUp();
		calculator = new MyCalculatorSeeIt();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	@Test
	/**
	 * Positive testcase for addNumbers method
	 */
	public void testAddNumbers_Positive() {
		int num1 = 23;
		int num2 = 34;
		try {
			assertEquals(57, calculator.addNumbers(num1, num2));
		} catch (ArithmeticException ex) {
			fail("No exception should be thrown");
		}
	}


	@Test
	/**
	 * Negative testcase for checking result exceeding 8 digits
	 */
	public void testAddNumbers_Negative() {
		int num1 = 99999999;
		int num2 = 1;
		try {
			assertEquals(100000000, calculator.addNumbers(num1, num2));
		} catch (ArithmeticException ex) {
			assertEquals("-Error-", ex.getMessage());
		}
	}


}
